<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/client/backgroundManagement/commons/global.jsp" %>
<script type="text/javascript">

    $(function() {
        
 
        
    	//负责人
   	 $('#managerUser').combobox({
      // $('#managerUser').combotree({
           url : '${path }/userController/tree',
           valueField:'id' ,
           textField:'text' ,
           lines : true,
           editable:true,
           value :'${organization.organizationManagerId}'
           
       });
   	// alert('${organization.organizationType}')
      var parentId = '${organization.parentId}';
      if(parentId==0){
    	  parentId=""
      }
       
      //所属部门
       $('#pid').combotree({
           url : '${path }/organizationController/tree?type=parentOrg',
           parentField : 'pid',
           lines : true,
         //  required: true, 当不选择时如何??
           value :parentId
       });
      
        
        $('#organizationEditForm').form({
            url : '${path }/organizationController/edit',
            onSubmit : function() {
                progressLoad();
                var isValid = $(this).form('validate');
                if (!isValid) {
                    progressClose();
                }
                return isValid;
            },
            success : function(result) {
                progressClose();
                result = $.parseJSON(result);
                if (result.success) {
                    parent.$.modalDialog.openner_treeGrid.treegrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_treeGrid这个对象，是因为organization.jsp页面预定义好了
                    parent.$.modalDialog.handler.dialog('close');
                }
            }
        });
        
    });
    $("#type").val('${organization.organizationType}' );
    
</script>
<div style="padding: 3px;">
    <form id="organizationEditForm" method="post">
        <table class="grid">
             
                 
                 <input name="id" type="hidden"  value="${organization.id}"> 
                  <input name="oldhechaTarget" type="hidden"  value="${organization.hechaTarget}"> 
                   <input name="oldqiatanTarget" type="hidden"  value="${organization.qiatanTarget}"> 
           
            <tr>

                <td>部门名称</td>
                <td><input name="name" type="text" placeholder="请输入部门名称" class="easyui-validatebox" data-options="required:true"  value="${organization.organizationName}"></td>
                
            </tr>
            <tr>
              <td>类型</td>
                    <td>
                        <select name="type" id="type" class="easyui-combobox" data-options="width:150,height:29,editable:false,panelHeight:'auto'">
                            <option value="1">集团/公司</option>
                            <option value="2">事业部门</option>
                            <option value="3" selected="selected">拓展小组</option>
                        </select>
                    </td>
                    
            <tr>
            <tr>
                <td>负责人</td>
                <td colspan="3"><select id="managerUser" name="managerUser" style="width:150px;height: 29px;"></select>
            </tr>
            <tr>
                <td>上级部门</td>
                <td colspan="3"><select id="pid" name="pid" style="width:150px;height: 29px;"></select>
                <a class="easyui-linkbutton" href="javascript:void(0)" onclick="$('#pid').combotree('clear');" >清空</a></td>
                
            </tr>
 			<!-- -->
			<c:if test="${organization.organizationType=='3'}">
				  <tr>
	             <td>核查项目指标</td>
	                <td><input name="hechaTarget" type="text" value="${organization.hechaTarget}" placeholder="请输入指标" class="easyui-numberbox"  data-options="required:true" ></td>
	            </tr>
	            
	             <tr>
	             <td>洽谈项目指标</td>
	                <td><input name="qiatanTarget" type="text" value="${organization.qiatanTarget}" placeholder="请输入指标" class="easyui-numberbox"  data-options="required:true" ></td>
	            </tr>
			</c:if>
			 
        </table>
    </form>
</div>
